package com.example.event_resource_java.authority.mapper;

import com.example.event_resource_java.authority.dao.PaperDao.PracticeRecordDO;
import com.example.event_resource_java.authority.dao.StatisticDao.LearnRecordsDao;
import com.example.event_resource_java.commons.vo.StatisticVO.LearnTimeStatisticDetailVO;
import com.example.event_resource_java.commons.vo.StatisticVO.LearnTimeStatisticListVO;
import com.example.event_resource_java.commons.vo.StatisticVO.PracticeRecordDetailsVO;
import com.example.event_resource_java.commons.vo.StatisticVO.PracticeRecordListVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

@Mapper
public interface StatisticMapper {

    /**
     * 学生个人练习记录 解决幻读问题 for update
     *
     * @param userId
     * @return
     */
    List<PracticeRecordDetailsVO> practiceDetailList(Long userId, Integer state);

    /**
     * 班级学生练习记录 只统计已完成
     *
     * @param createrId
     * @param studentName
     * @param classname
     * @return
     */
    List<PracticeRecordListVO> practiceRecordList(Long createrId, String studentName, String classname);

    /**
     * 班级学习时长列表
     *
     * @param createrId
     * @param studentName
     * @param classname
     * @return
     */
    List<LearnTimeStatisticListVO> learnTimeList(Long createrId, String studentName, String classname);

    /**
     * 学生个人学习时长列表
     *
     * @param userId
     * @param evnMoId
     * @return
     */
    List<LearnTimeStatisticDetailVO> personalLearnTimeList(Long userId, Long evnMoId);

    /**
     * 保存观看记录
     *
     * @param learnRecordsDao
     * @return
     */
    boolean saveLearnTime(@Param("learnRecordsDao") LearnRecordsDao learnRecordsDao);

    /**
     * 重新播放
     *
     * @param userId
     * @param allocationsId
     * @param classId
     * @return
     */
    LearnRecordsDao backup(Long userId, Long allocationsId, Long classId);

    boolean updateLearnTime(String latestTime, Integer watchedTime, Integer state,
                            Long userId, Long allocationId, Long classId, Long allocationsId);

    /**
     * 获取练习记录
     *
     * @param paperId
     * @param classId
     * @param userId
     * @return
     */
    PracticeRecordDO getPracticeRecord(Long paperId, Long classId, Long userId);

    /**
     * 未做完练习
     * @param paperId
     * @param classId
     * @param userId
     * @return
     */
    Long PracticeRecordId(Long paperId, Long classId, Long userId, Long allocationId);

    boolean updatePracticeRecordInfo(Long userId, String name);

    boolean deletePracticeRecord(Long userId);

    boolean deleteLearnRecord(Long userId);
}
